<template>
	<view class="shoplist">
		<hotshop @goxqy="goxqy" :hotshop="hotshop"></hotshop>
		<view class="di" v-show="num==2">
			-我是有底线的-
		</view>
	</view>
</template>

<script>
	import hotshop from '../../componets/hotshop.vue'
	export default {
		data() {
			return {
				hotshop:[],
				hotshopb:[],
				hotshopc:[],
				num:0
			};
		},
		onLoad(){
			this.getshoplist()
		},
		methods:{
			getshoplist(){
				uni.request({
					url: "http://demo.itlike.com/web/xlmc/api/homeApi",
					success: res => {
						console.log(res)
						this.hotshop = res.data.data.list[4].product_list   //推荐商品
						
						this.hotshopb = res.data.data.list[5].product_list  //下拉加载1
						this.hotshopc = res.data.data.list[6].product_list  //下拉加载2
					}
				})
			},
			//详情页
			goxqy(item) {
				uni.navigateTo({
					url: '../xqy/xqy?xqyshop=' + encodeURIComponent(JSON.stringify(item))
				})
				console.log(item)
			}
		},
		onReachBottom(){
			console.log(1111)
			if(this.num == 0){
				this.hotshop = [...this.hotshop,...this.hotshopb]
				this.num++
			}else if(this.num == 1){
				this.hotshop = [...this.hotshop,...this.hotshopc]
				this.num++
			}
		},
		components:{
			hotshop
		}
	}
</script>

<style lang="scss">
	.shoplist{
		background-color: #F8F8F8;
	}
	.di{
		color: #ccc;
		padding: 50rpx;
		text-align: center;
		height: 40rpx;
		line-height: 40rpx;
	}
</style>
